﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QuanLiNhaSachDAO;
using System.Windows.Forms;
namespace QuanLiNhaSachBUS
{
    public class BaoCaoBUS
    {
        public static DataTable layPhieuNhap(DateTime tuNgay, DateTime denNgay)
        {
            try
            {
                string _tuNgay = tuNgay.ToShortDateString();
                string _denNgay = denNgay.ToShortDateString();
                return BaoCaoDAO.layPhieuNhap(_tuNgay, _denNgay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static DataTable layPhieuXuat(DateTime tuNgay, DateTime denNgay)
        {
            try
            {
                string _tuNgay = tuNgay.ToShortDateString();
                string _denNgay = denNgay.ToShortDateString();
                return BaoCaoDAO.layPhieuXuat(_tuNgay, _denNgay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static string layTongTienNhap(DateTime tuNgay, DateTime denNgay)
        {
            try
            {
                string _tuNgay = tuNgay.ToShortDateString();
                string _denNgay = denNgay.ToShortDateString();
                return BaoCaoDAO.layTongTienNhap(_tuNgay, _denNgay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static string layTongTienXuat(DateTime tuNgay, DateTime denNgay)
        {
            try
            {
                string _tuNgay = tuNgay.ToShortDateString();
                string _denNgay = denNgay.ToShortDateString();
                return BaoCaoDAO.layTongTienXuat(_tuNgay, _denNgay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static DataTable layChiTietPhieuXuat(string id)
        {
            try
            {

                return BaoCaoDAO.layChiTietPhieuXuat(id);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static DataTable layChiTietPhieuNhap(string id)
        {
            try
            {

                return BaoCaoDAO.layChiTietPhieuNhap(id);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }

        public static DataTable baoCaoSach(DateTime tuNgay, DateTime denNgay)
        {
            try
            {
                string _tuNgay = tuNgay.ToShortDateString();
                string _denNgay = denNgay.ToShortDateString();
                return BaoCaoDAO.baoCaoSach(_tuNgay, _denNgay);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi khi load");
            }
            return null;
        }
    }
}
